Redirect command to input of another in Python